<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" />
	<title></title>

	<script src="../static/js/jcinvccbar-pure.min.js" type="text/javascript" charset="utf-8"></script>
	<link rel="stylesheet" type="text/css" href="../static/jquery-easyui-1.4/themes/metro/easyui.css">
	<link rel="stylesheet" type="text/css" href="../static/jquery-easyui-1.4/themes/mobile.css">
	<link rel="stylesheet" type="text/css" href="../static/jquery-easyui-1.4/themes/icon.css">

	<script src="../static/jquery-easyui-1.4/jquery.min.js" type="text/javascript"></script>
	<script src="../static/jquery-easyui-1.4/jquery.easyui.min.js" type="text/javascript"></script>
	<script type="text/javascript" src="../static/jquery-easyui-1.4/jquery.easyui.mobile.js"></script>

	<script src="../static/scripts/socket.io.js" type="text/javascript"></script>
	<script src="../static/scripts/AgoraRTCSDK-3.0.0.js" type="text/javascript"></script>
	<script src="../static/scripts/jssip.min.js" type="text/javascript"></script>
	<script src="../static/scripts/jcinvccbar-pure.min.js" type="text/javascript"></script>
	<script src="../static/js/jbarextent.mobile.js" type="text/javascript" charset="utf-8"></script>

	<script src="../static/scripts/ui/jbardisplay.js" type="text/javascript"></script>
	<script src="../static/js/jbarextent.js" type="text/javascript"></script>
</head>
<body onload="onPageLoaded();">

<div class="easyui-navpanel">
	<header>
		<div style="padding:10px">
			<span>呼叫中心座席</span>
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<span id="idAgentStatus">座席状态：【未登录】</span>
		</div>
	</header>
	<div id="agent_webcam"
		 style="cursor: move; position: relative; border: 2px solid rgb(70, 163, 255); border-radius: 10px; left: 10px; top: 5px; width: 360px; height: 300px; background: rgb(130, 130, 130); display: none;">
		<div id="agent_remoteView2" style="width:360px; height: 300px;background-color: transparent;"></div>
		<div id="agent_shareView2"
			 style="position:absolute;left:150px;bottom: 6px;width: 133px;height: 100px;background-color: #aaaaaa;border-top: 2px solid #aaaaaa;border-right: 2px solid #aaaaaa;display:none">
		</div>
		<div id="agent_selfView2"
			 style="position:absolute;left:8px;bottom: 6px;width: 133px;height: 100px;background-color: #aaaaaa;border-top: 2px solid #aaaaaa;border-right: 2px solid #aaaaaa;">
		</div>
	</div>

	<div class="easyui-tabs" id="divMainPage"
		 data-options="tabHeight:60,fit:true,tabPosition:'bottom',border:false,pill:true,narrow:true,justified:true">
		<!--label1-->
		<div style="padding:10px">
			<!--底部1-->
			<div class="panel-header tt-inner">
				<img src='../static/jquery-easyui-1.4/themes/images/modem.png' /><br>外呼
			</div>
			<!--主体1-->
			<div title="登陆" id="divPadLogin">
				<ul class="m-list">
					<li><span>集团号</span>&nbsp;<input class="easyui-textbox" name="corpVccIdTxt"
													 id="corpVccIdTxt" value="100009" prompt="VccID..." style="width:100%"></li>
					<li><span>座席工号</span>&nbsp;<input class="easyui-textbox" name="agentIdTxt" id="agentIdTxt"
													  value="1001" prompt="AgentID..." style="width:100%"></li>
					<li ><span>座席密码</span>&nbsp;<input class="easyui-textbox" name="agentPassword"
													   id="agentPassword" value="111111" prompt="agentPassword..."
													   style="width:100%;display: none;"></li>
					<li><span>服 务 器</span>&nbsp;<input class="easyui-textbox"
													   name="serverIpTxt" id="serverIpTxt" value="47.108.197.168" prompt="MainIP..."
													   style="width:100%"></li>
					<li ><span>端口号</span>&nbsp;<input class="easyui-textbox" name="portTxt" id="portTxt"
													  value="5049" prompt="serverPort..." style="width:100%;"></li>
					<li ><span>SIP密码</span>&nbsp;<input class="easyui-textbox" name="sipPassword"
														id="sipPassword" value="Q6v^!t@HS1Cd?qF" prompt="sipPassword..." style="width:100%;display: none;">
					</li>
					<li ><span>sipxpath</span>&nbsp;<input class="easyui-textbox"
														   name="sipXPath" id="sipXPath" value="acd" prompt="sipXPath..." style="width:100%">
					</li>
					<a onclick="login();" class="easyui-linkbutton c4" style="width:100%;height:30px"><span
							style="font-size:16px">Login</span></a>
				</ul>
			</div>
			<div  id="divPadParam" style="display:none;">
				<span>客户号码</span>&nbsp;<input class="easyui-textbox" name="DestNum" id="DestNum" value=""
											  style="width:100%">
				<a onclick="application.oJVccBar.MakeCall(DestNum.value,2,'');"
				   class="easyui-linkbutton" plain="true" outline="true"
				   style="width:100px;height:35px"><span style="font-size:16px">呼叫</span></a>
				<a onclick="application.oJVccBar.Disconnect();"
				   class="easyui-linkbutton" plain="true" outline="true"
				   style="width:100px;height:35px"><span style="font-size:16px">挂断</span></a>
				<a onclick="UnInitial();"
				   class="easyui-linkbutton" plain="true" outline="true"
				   style="width:100px;height:35px"><span style="font-size:16px">退出</span></a>
			</div>
		</div>
	</div>
</div>
<style scoped>
			.tt-inner {
				display: inline-block;
				line-height: 12px;
				padding-top: 5px;
			}

			p {
				line-height: 150%;
			}
		</style>
</body>
<script src="../static/js/jcinvccbar-pure.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" onload="onPageLoaded();">
		function onPageLoaded() {
			if (document.readyState == "complete") {
				var param = "47.108.197.168|100009|1002|5049|Q6v^!t@HS1Cd?qF|111111|sbc";
				var oParam = param.split("|");
				serverIpTxt.value = oParam[0];
				corpVccIdTxt.value = oParam[1];
				agentIdTxt.value = oParam[2];
				portTxt.value = oParam[3];
				sipPassword.value = oParam[4];
				agentPassword.value = oParam[5];
				sipXPath.value = oParam[6];

				$("#serverIpTxt").textbox('setText', oParam[0]);
				$("#corpVccIdTxt").textbox('setText', oParam[1]);
				$("#agentIdTxt").textbox('setText', oParam[2]);
				$("#portTxt").textbox('setText', oParam[3]);
				$("#sipPassword").textbox('setText', oParam[4]);
				$("#agentPassword").textbox('setText', oParam[5]);
				$("#sipXPath").textbox('setText', oParam[6]);
				//if(oParam.length>5)
				//  agnetPassword.value = oParam[5];
				if (oParam.length > 6)
					sipXPath.value = oParam[6];

				applicationLoad("", setVccBarMobileEvent);


				$("#divMainPage").tabs('select', 0);
				this.getUrl();

			}
		}

		function login() {

			var corpVccIdTxt4J = $("#corpVccIdTxt");
			var agentIdTxt4J = $("#agentIdTxt");
			var serverIpTxt4J = $("#serverIpTxt");
			var portTxt4J = $("#portTxt");
			var sipPassword4J = $("#sipPassword");
			var sipXPath4J = $("#sipXPath");
			var agentPassword4J = $("#agentPassword");

			var vccID = corpVccIdTxt4J.val();
			var agentID = agentIdTxt4J.val();
			var serverIP = serverIpTxt4J.val();
			var serverPort = portTxt4J.val();
			var sipPassword = sipPassword4J.val();
			var sipXPath = sipXPath4J.val();
			var agentPassword = agentPassword4J.val();
			//
			if (!serverIP) {
				serverIP = window.location.hostname;
			}
			//
			if (!serverPort) {
				serverPort = 5049;
			}
			//
			if (!vccID) {
				alert("请输入企业标识！");
				corpVccIdTxt4J.focus();
				return;
			}
			//
			if (!agentID) {
				alert("请输入坐席工号！");
				agentIdTxt4J.focus();
				return;
			}

			showLog("serverIP=[" + serverIP + ":" + serverPort + "] vccID=[" + vccID + "] agentID=[" + agentID + "]");
			//

			application.oJVccBar.SetAttribute("MainIP", serverIP);
			application.oJVccBar.SetAttribute("MainPortID", serverPort);
			application.oJVccBar.SetAttribute("BackIP", serverIP);
			application.oJVccBar.SetAttribute("BackPortID", serverPort);
			application.oJVccBar.SetAttribute("SipServerIP", serverIP);
			application.oJVccBar.SetAttribute("SipServerPort", serverPort);
			application.oJVccBar.SetAttribute("SipProtocol", "wss");
			application.oJVccBar.SetAttribute("PhonType", 1); //0:内置坐席卡；1：内置Sip；2：外置其他终端
			application.oJVccBar.SetAttribute("AgentType", 1);
			application.oJVccBar.SetAttribute("SelfPrompt", 0);
			application.oJVccBar.SetAttribute("MediaFlag", vccID);
			application.oJVccBar.SetAttribute("PassWord", agentPassword);
			application.oJVccBar.SetAttribute("AgentID", "000010" + vccID + agentID);
			application.oJVccBar.SetAttribute("Dn", "000002" + vccID + agentID);

			application.oJVccBar.SetAttribute("AppType", 0); //0:agent 1:monitor 2:agent+monitor
			application.oJVccBar.SetAttribute("SipXPath", sipXPath);
			application.oJVccBar.SetAttribute("SipPassWord", sipPassword);
			application.oJVccBar.SetAttribute("WeChatServer", serverIP + ":8000");
			//application.oJVccBar.SetAttribute("PhonType",parseInt(oPhoneType.options[oPhoneType.options.selectedIndex].value));
			application.oJVccBar.SetAttribute("ProtocolType", 1); //1:https  0:http

			application.oJVccBar.Initial();
			$("#divPadParam").show()
			$("#divPadLogin").hide()


		}


		function SelTableItem(title) {

		}
		function UnInitial(){
			application.oJVccBar.UnInitial();
			$("#divPadLogin").show()
			$("#divPadParam").hide()
		}

		function getUrl(){

        var ajaxObj = new XMLHttpRequest();

        ajaxObj.open('get', 'https://47.108.197.168:5049/');

        ajaxObj.send();

        ajaxObj.onreadystatechange = function () {

            if (ajaxObj.readyState == 4 && ajaxObj.status == 200) {

                console.log('数据返回成功');

                // 数据是保存在 异步对象的 属性中
                console.log(ajaxObj.responseText);

                // 修改页面的显示
                document.querySelector('').innerHTML = ajaxObj.responseText;
            }
        }
		}
	</script>

</html>
